<!DOCTYPE>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Const关键字声明</title>

    <script>
        var const_pi = 3.141;
        var r = 2;
        console.log(const_pi * r * r);
    </script>

    <script src="js/traceur.js"></script>
    <script src="js/bootstrap.js"></script>
    <script type="module">
        const pi = 3.141;
        var r = 2;
        console.log(pi * r * r);
    </script>

    <!--const关键字跟let关键字的作用域相同-->
    <script type="module">
        const a = 12;
        function myFunction() {
            console.log(a);
            const b = 13;
            if(true){
                const c = 14;
                console.log(b);
            }
//            console.log(c);
        }
        myFunction();
    </script>

    <!--const变量的值为对象时-->
    <script type="module">
        const a = {
            "name": "John"
        };
        console.log(a.name);
        a.name = "amiee";
        console.log(a.name);

    </script>
</head>
</html>